﻿@model Int32
@{
    var isExpertGroupLeader = false;
    PessModel.PESSEntities db = new PessModel.PESSEntities();
    var currentUser=Membership.GetUser();
    if(currentUser!=null)
    {
        if(db.ExpertGroups.Where(g => g.LeaderID == currentUser.UserName).Count()>0)
        {
            isExpertGroupLeader = true;
        }
    }

    bool hideArchiveDetails = false;
    bool isGradeRulesEnabled = false;
    var activity = db.Activities.Find(Model);
    if(activity!=null)
    {
        hideArchiveDetails = (bool)activity.HideArchiveDetails;
        isGradeRulesEnabled = activity.IsGradingRulesEnabled!=null?(bool)activity.IsGradingRulesEnabled:false;
    }
}
@if(Model>0)
{
    <link href="@Url.Content("~/content/subnav.css")" rel="stylesheet" type="text/css"/>

    <ul>
        <li>@if (Membership.GetUser()!=null) 
            { 
                @Html.MenuLink("基本信息", "Details", "Activity", new { id = Model }); 
            }
        </li>
        <li>@if(Membership.GetUser()!=null&&Roles.IsUserInRole(Membership.GetUser().UserName,"Admin"))
            {
                @Html.MenuLink("配额","Quota","CandidateQuota",new {ActivityID=Model});
            }
        </li>
        <li>@if (Membership.GetUser() != null && (Roles.IsUserInRole(Membership.GetUser().UserName, "Admin")||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "CountyAdmin")||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "ExpertJudge")||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "Author")
                                                  ))
            {
                @Html.MenuLink("档案及评分", "Index", "Archive", new { ActivityID = Model });
            }
        </li>
        <li>@if(Membership.GetUser()!=null&&Roles.IsUserInRole(Membership.GetUser().UserName,"Admin"))
            {
                @Html.MenuLink("评委组","Index","ExpertGroup",new {ActivityID=Model});
            }
        </li>
        <li>@if (Membership.GetUser() != null && (Roles.IsUserInRole(Membership.GetUser().UserName, "Admin")||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "ExpertJudge")
                                                  ))
            {
                //if(!hideArchiveDetails)
                //{
                    @Html.MenuLink("评分规则","Index","Rule",new {ActivityID=Model});
                //}
            }
        </li>
        @if(isGradeRulesEnabled)
        {
        <li>
            @if (Membership.GetUser() != null && (Roles.IsUserInRole(Membership.GetUser().UserName, "Admin") ||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "ExpertJudge")
                                                  ))
            {
                @Html.MenuLink("等第规则", "Index", "GradeRule", new { ActivityID = Model });
            }
        </li>
        }

        <li>
            @if (Membership.GetUser() != null && Roles.IsUserInRole(Membership.GetUser().UserName, "Admin"))
        {
            //if(!hideArchiveDetails)
            //{
            @Html.MenuLink("评语标准", "Index", "Standard", new { ActivityID = Model });
            //}
        }
        </li>

        <li>
            @if (Membership.GetUser() != null && (Roles.IsUserInRole(Membership.GetUser().UserName, "Admin") ||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "ExpertJudge")
                                                  &&isExpertGroupLeader))
            {
                @Html.MenuLink("评分汇总","ScoreReport","Report",new {ActivityID=Model})
            }
        </li>
    </ul>
   <p>@db.Activities.Find(Model).Name</p>
    <div class="f-cb"></div>
}